home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
fg
/
fgl402b
/
manuals.arj
/
USERAPP.DOC
< prev
Wrap
Text File
|
1995-02-06
|
84KB
|
1,611 lines
Appendix A
Fastgraph Utilities
356 Fastgraph User's Guide
Overview
This appendix describes the utility programs supplied with Fastgraph. By
default, the Fastgraph installation procedure places these utilities in the
\FG directory. To use these utilities, you must either (1) copy the EXE file
from \FG to your current directory, (2) make \FG your current directory, or
(3) include the \FG directory in your DOS path specification.
SNAPSHOT Utility
The SNAPSHOT utility is a terminate and stay resident program (TSR) to
capture graphic images. It stores the image in Fastgraph's standard pixel run
(SPR) format. To load SNAPSHOT, just enter the command SNAPSHOT at the DOS
prompt, and you'll see messages similar to the following if SNAPSHOT loads
successfully.
C> SNAPSHOT
SNAPSHOT Version 1.04
Copyright (c) 1993 Ted Gruber Software. All Rights Reserved.
Press <alt>-<left shift> to activate.
After SNAPSHOT loads, control returns to the DOS prompt. At this point,
you can use any method whatsoever to display a graphic image and then press
the Alt and left shift keys at the same time to capture the image. You don't
need to load SNAPSHOT for each image capture, just once per system boot.
SNAPSHOT uses about 24,000 bytes of conventional memory once loaded.
To illustrate the use of SNAPSHOT, suppose you have drawn and saved an
image with a commercial paint program, and you want to incorporate this image
into a Fastgraph application. Once you load SNAPSHOT, start the paint program
and retrieve your image. Then press the Alt and left shift keys simultaneously
and wait for the success tone (three quick medium-pitched sounds). Finally,
exit the paint program to return to the DOS prompt.
The sequence described in the preceding paragraph will store the captured
image in Fastgraph's standard pixel run format, in a file named SNAPSHOT.nnn
in the current directory. The file type nnn will be the first sequence of
digits that does not result in a duplicate file name. That is, if there are no
captured image files in the current directory, SNAPSHOT will use the file name
SNAPSHOT.000. The next time you capture an image, SNAPSHOT will store it in
SNAPSHOT.001, then SNAPSHOT.002, and so forth. If you rename or delete one of
these files, SNAPSHOT will again use that file name. For example, if you
delete SNAPSHOT.000 but keep SNAPSHOT.001, SNAPSHOT will store the next image
it captures in SNAPSHOT.000.
If SNAPSHOT is unable to capture the image, it will produce its error
tone (a single low-pitched sound). The most common cause of this is trying to
capture an image from a text video mode, but it also will occur if there is
not enough disk space or if all 1,000 image file names are already being used.
Appendix A: Fastgraph Utilities 357
CLIP Utility
The SNAPSHOT utility described in the previous section captures the
entire screen. While this might be desirable in some cases, other times you'll
just need a portion of the screen. CLIP is an interactive utility that you can
use to reduce the size of any image stored in Fastgraph's standard or packed
pixel run format. The syntax of the command for invoking the CLIP utility from
the DOS prompt is
CLIP input_file output_file options
where input_file is the name of the original image file, and output_file is
the name of the new image file. CLIP does not modify the input_file in any
way, but it will overwrite the output_file if an identically named file exists
in the current directory. The options list specifies one or more optional
switches as shown here:
option meaning
/M:mode Specifies the video mode number in which to display the image. The
mode value must be an integer between 0 and 29. If that video mode
is a text mode, an unsupported graphics mode, or an unavailable
graphics mode, CLIP displays an error message stating this. If the
/M switch is not present, CLIP uses the first available video mode
from the list 18, 16, 15, 19, 13, 9, 4, 12.
/P Indicates the input_file is in Fastgraph's packed pixel run format.
If the /P switch is not present, CLIP assumes it is in standard
pixel run format. The output_file will be in the same format as the
input_file.
/W:width Specifies the image width in pixels. The width value must be an
integer between 1 and the horizontal resolution of the selected
video mode. If the /W switch is not present, CLIP uses the
horizontal resolution of the selected video mode.
For example, if you wanted to create the image file PARTIAL.PPR from the
packed pixel run file SCREEN.PPR, and use the native 320x200 EGA graphics
video mode (mode 13), you would start CLIP with the following command.
CLIP PARTIAL.PPR SCREEN.PPR /P /M:13
Because no /W switch appears in the above command and the horizontal
resolution of mode 13 is 320 pixels, CLIP assumes the image width is 320
pixels.
When CLIP displays the image and the plus-shaped cursor, you are ready to
define one corner of the clipping region (that part of the image used to
create the output_file). To do this, use the directional keys on the numeric
keypad to move the cursor to the desired position, then press the Enter key.
You are then ready to define the clipping region's opposite corner. Again, use
the directional keys to move the cursor to the desired position. When defining
the second corner, however, CLIP uses a rectangular box instead of the plus-
shaped cursor to simplify marking the clipping region's boundaries. After you
press Enter to define the second corner, CLIP creates the output_file and
358 Fastgraph User's Guide
displays the resulting image width and the number of pixel runs the image
contains.
CLIP includes other features to help define the clipping region. You can
change the distance the cursor moves in response to the directional keys,
display the current (x,y) pixel coordinates of the cursor, and change the
cursor color. The following table explains the keystrokes that CLIP recognizes
when you are defining the clipping region.
key meaning
F1 Displays the (x,y) coordinate bar at the top of the screen. If the
coordinate bar is already on, F1 removes it.
F2 Displays the (x,y) coordinate bar at the bottom of the screen. If
the coordinate bar is already on, F2 removes it.
F3 Changes the cursor or box color from white to black, or from black
to white.
F4 Displays a summary of the keys CLIP recognizes when defining the
clipping region.
KP1 Moves the cursor one unit down and to the left.
KP2 Moves the cursor one unit down.
KP3 Moves the cursor one unit down and to the right.
KP4 Moves the cursor one unit to the left.
KP6 Moves the cursor one unit to the right.
KP7 Moves the cursor one unit up and to the left.
KP8 Moves the cursor one unit up.
KP9 Moves the cursor one unit up and to the right.
+ Increases the unit of cursor movement by one pixel. The default
cursor movement is one pixel.
- Decreases the unit of cursor movement by one pixel.
Enter Defines a corner of the clipping region at the cursor position.
Esc Exits to DOS without creating the output_file. CLIP will first issue
an "Exit to DOS?" prompt in case you pressed the Esc key
accidentally.
CONVERT Utility
The CONVERT utility lets you translate files between Fastgraph's SPR and
PPR image file formats. The syntax of the command for invoking CONVERT from
the DOS prompt is
CONVERT input_file output_file
where input_file is the name of the original image file, and output_file is
the name of the new translated image file. CONVERT does not modify the
input_file in any way, but it will overwrite the output_file if an identically
named file exists in the current directory.
By default, the file type of the input_file and output_file determine the
image format of that file. If the file type is PPR, CONVERT assumes the image
is in Fastgraph's packed pixel run format. If the file type is SPR, CONVERT
assumes it is in the Fastgraph's standard pixel run format. If your image
files use other file types, you can explicitly specify the file's image format
by appending one of the switches /PPR or /SPR to the file name. The input_file
Appendix A: Fastgraph Utilities 359
and output_file must not both specify the same image format (CONVERT will
display an error message if this is so).
The following command will translate the standard pixel run file
PICTURE.SPR to packed format. The packed image will be stored in the file
PICTURE.IMG, so we must append the switch /PPR to tell CONVERT that it will be
a packed file.
CONVERT PICTURE.SPR PICTURE.IMG/PPR
EDITSPR Utility
The EDITSPR utility changes all pixel runs of one color to another color
in an image file stored in Fastgraph's standard pixel run (SPR) format. The
syntax of the command for invoking the EDITSPR utility from the DOS command
prompt is
EDITSPR input_file output_file
where input_file is the name of the original image file, and output_file is
the name of the new image file. EDITSPR does not modify the input_file in any
way, but it will overwrite the output_file if an identically named file exists
in the current directory.
After it reads the pixel runs from the input_file, EDITSPR will perform
the requested color changes. It does this iteratively by asking for an old
color value followed by a new color value (each value must be between 0 and
255). EDITSPR then finds the pixel runs of the old color value and changes
them to the new color value. Following this, EDITSPR displays a message
stating how many pixel runs it changed. This process repeats until you enter a
negative number for either color value.
EDITSPR will next combine adjacent pixel runs of like colors. For
example, suppose the original image file contained a color 1 pixel run of
length 50, followed by a color 2 pixel run of length 20, followed by another
color 1 pixel run of length 10. If you changed all color 2 pixel runs to color
1, EDITSPR will combine these three pixel runs into a single run of length 80.
GrabRGB Utility
The GrabRGB utility is a terminate and stay resident program (TSR) to
capture the current red, green, and blue color components of video DAC
registers in 256-color graphics modes. You can use GrabRGB together with
Fastgraph's SNAPSHOT utility to preserve the original colors of a captured
image.
To load GrabRGB, just enter the command GRABRGB at the DOS prompt. After
GrabRGB loads, control returns to the DOS prompt. At this point, you can use
any method whatsoever to display a 256-color graphic image and then press the
Alt and right shift keys at the same time to capture the current DAC values.
You don't need to load GrabRGB for each image, just once per system boot.
GrabRGB uses about 28,000 bytes of conventional memory once loaded.
360 Fastgraph User's Guide
To illustrate the use of GrabRGB, suppose you have drawn and saved a 256-
color image with a commercial paint program, and you want to incorporate this
image into a Fastgraph application. Once you load SNAPSHOT and GrabRGB, start
the paint program and retrieve your image. Then press the Alt and left shift
keys to capture the image with SNAPSHOT. After SNAPSHOT's success tone (three
quick medium-pitched sounds), press Alt and right shift to capture the RGB
components of each DAC register with GrabRGB, and wait for GrabRGB's success
tone. Finally, exit the paint program and return to the DOS prompt.
The sequence described in the preceding paragraph will write the RGB
color components for each DAC register to a file named GRABRGB.nnn in the
current directory. The file type nnn will be the first sequence of digits that
does not result in a duplicate file name. That is, if there are no GrabRGB
output files in the current directory, GrabRGB will use the file name
GRABRGB.000. The next time you use GrabRGB, it will store the RGB information
in GRABRGB.001, then GRABRGB.002, and so forth. If you rename or delete one of
these files, GrabRGB will again use that file name. For example, if you delete
GRABRGB.000 but keep GRABRGB.001, GrabRGB will next use the file name
GRABRGB.000.
If GrabRGB is unable to obtain the RGB components of each DAC register,
it will produce its error tone (a single low-pitched sound). The most common
cause of this is trying to capture an image from a text video mode, or from a
graphics video mode with fewer than 256 colors. It also will occur if there is
not enough disk space or if all 1,000 output file names are already being
used.
Each line in the output file created by GrabRGB is of the form
nnn,rr,gg,bb,
where nnn is a DAC register index (between 0 and 255), rr is the red component
of that DAC register, gg is the green component, and bb is the blue component.
Each color component is between 0 and 63. You can edit and reformat these
lines as necessary for inclusion in a C or C++ initializer list, a BASIC or
FORTRAN data statement, or a Pascal array-type constant list. Such an array of
RGB components, but without the nnn indices, is in the format expected by
fg_setdacs.
By default, GrabRGB captures information for all 256 DAC registers. If
you want to consider only the DAC registers with color components different
from their default values, just include the /D option when you load GrabRGB
(that is, use the command GRABRGB /D). If you specify the /D option and all
256 DACs use their default values, the output file will contain a message
stating this.
HERCFIX Utility
The HERCFIX utility allows you to use SNAPSHOT (and possibly other TSRs)
with programs that do not update the BIOS data area when establishing the
720x348 Hercules graphics mode. If you use SNAPSHOT with such a program, it
will think the monochrome text mode (video mode 7) is active and will produce
its low-pitched error tone when activated.
Appendix A: Fastgraph Utilities 361
If this occurs, use HERCFIX to load the application from which you are
trying to capture the image. To do this, enter
HERCFIX command
at the DOS prompt, where command is the command that starts the application.
For example, suppose you use the command PAINTER /H to run a commercial paint
program in Hercules graphics mode. To load the paint program with HERCFIX, you
would enter the command HERCFIX PAINTER /H.
PCXHEAD Utility
The PCXHEAD utility displays the most important information from the
header of a PCX file. This consists of the PCX version number, the number of
bits per pixel, the number of bit planes, the scan line width, and the image
dimensions and screen position. It also proposes the optimal video mode for
displaying the PCX file. By optimal, we mean the compatible video mode having
the lowest resolution larger than or equal to the image dimensions. For 256-
color PCX images, PCXHEAD displays the extended color palette if one is
present.
The syntax of the command for invoking the PCXHEAD utility from the DOS
command prompt is
PCXHEAD pcx_file
where pcx_file is the name of the PCX file to examine. PCXHEAD does not modify
the pcx_file in any way. If the PCX file includes an extended color palette,
you may prefer to direct the PCXHEAD output to a file using the DOS
redirection operator (>).
362 Fastgraph User's Guide
Appendix B
Using Fastgraph
from Assembly Language
364 Fastgraph User's Guide
The information in this appendix provides information about calling
Fastgraph routines from assembly language programs. It is not intended to be a
complete tutorial on the subject, but it should provide experienced assembly
language programmers with enough details to call Fastgraph routines in their
applications.
Fastgraph uses the same naming and stack-based calling conventions used
by Borland, Microsoft, and other companies in their C and C++ compilers. The
details of these conventions important to assembly language programming are
summarized below. If you're calling Fastgraph routines from an assembly
language program, the program must follow these conventions.
* All arrays and pointers are passed by reference.
* All other items are passed by value.
* Arguments are pushed onto the stack in reverse
order.
* The calling program is responsible for removing
the arguments from the stack.
* 16-bit function values are returned in the AX
register.
* 32-bit function values are returned in the DX:AX
register pair in 16-bit environments, or the EAX
register in 32-bit environments.
* Fastgraph routine names are prefixed with an
underscore.
The small and medium model real mode Fastgraph libraries pass arrays and
pointers by near reference (an offset into DGROUP), while the large model and
16-bit protected mode libraries do so by far reference (a segment:offset or
selector:offset pair). The 32-bit protected mode libraries use a flat model
architecture, meaning arrays and pointers are passed as 32-bit offsets into
DGROUP. This is consistent with the conventions and run-time libraries for the
supported compilers.
All Fastgraph routines preserve the (E)BP, (E)DI, (E)SI, and DS
registers. In the 32-bit protected mode libraries, the EBX and ES registers
are also preserved. The contents of any other registers are unknown upon
return from a Fastgraph routine (except for the (E)AX register, which will
either contain zero or the routine's return value).
Example B-1 calls fg_getmode, fg_setmode, fg_reset, and fg_version from
an assembly language program. The fg_getmode routine returns its function
value in the (E)AX register. The fg_setmode routine has a single argument,
while fg_reset has no arguments. The fg_version routine has two arguments,
both passed by reference. Notice how they are pushed on the stack in reverse
order. This example is written for the medium memory model. To make it work
with the large model libraries, add 8 instead of 4 to the (E)SP register
following the call to fg_version (because large model items passed by
reference are 32-bit segmented values). To make it work with the small model
library, change the word "far" to "near" in the EXTRN declarations, and change
the name of the code segment from "main_TEXT" to "_TEXT".
This example is in the file BB-01.ASM in the \FG\EXAMPLES directory. The
following commands show how to use MASM or TASM to assemble this program and
link it with the medium model real mode Fastgraph library.
Appendix B: Using Fastgraph from Assembly Language 365
Microsoft Macro Assembler (MASM) version 5:
MASM BB-01.ASM;
LINK /CP:4096 BB-01,,NUL,FGM;
Microsoft Macro Assembler (MASM) version 6:
ML /c /Cx /Zm BB-01.ASM
LINK /CP:4096 BB-01,,NUL,FGM;
Turbo Assembler (TASM):
TASM BB-01.ASM
TLINK BB-01.OBJ FGM.LIB
Example B-1.
EXTRN _fg_getmode:far ; Fastgraph's GETMODE routine
EXTRN _fg_reset:far ; Fastgraph's RESET routine
EXTRN _fg_setmode:far ; Fastgraph's SETMODE routine
EXTRN _fg_version:far ; Fastgraph's VERSION routine
stackseg SEGMENT stack
db 1024 dup (?) ; use a 1K stack
stackseg ENDS
_DATA SEGMENT word public 'DATA'
major dw ? ; major version number
minor dw ? ; minor version number
old_mode dw ? ; original video mode
_DATA ENDS
dgroup GROUP _DATA
ASSUME cs:main_TEXT,ds:dgroup
main_TEXT SEGMENT byte public 'CODE'
start: mov ax,_DATA ; load segment location
mov ds,ax ; into DS register
call _fg_getmode ; AX = current video mode
mov old_mode,ax ; save it
mov ax,4 ; use video mode 4
push ax ; pass argument fg_setmode
call _fg_setmode ; establish CGA four-color mode
add sp,2 ; remove fg_setmode argument
push old_mode ; pass argument to fg_setmode
call _fg_setmode ; restore original video mode
add sp,2 ; remove fg_setmode argument
call _fg_reset ; restore screen attributes
lea ax,minor ; get address of minor variable
push ax ; pass argument #2 to fg_version
lea ax,major ; get address of major variable
push ax ; pass argument #1 to fg_version
366 Fastgraph User's Guide
call _fg_version ; get the Fastgraph version number
add sp,4 ; remove fg_version arguments
mov ah,76 ; function 76: terminate process
xor al,al ; errorlevel 0
int 21h ; exit to DOS
main_TEXT ENDS
END start
Appendix C
Interrupts and Fastgraph
368 Fastgraph User's Guide
Interrupts Used by Fastgraph
DOS maintains an interrupt vector table where it stores the addresses of
256 interrupt handlers, or routines, that perform various functions. The
handlers are usually referenced by their hexadecimal interrupt number, between
00 and FF. Of these, only interrupts 60 through 66 and F1 through FF are not
used by DOS, the ROM BIOS, or other software and are thus available for user
applications.
Certain Fastgraph routines use some of the available interrupts. All
Fastgraph/Light routines use interrupt 62. In addition, Fastgraph's low-level
keyboard handler replaces interrupt 09. If your program defines its own
interrupt handlers, it must not use any interrupts reserved for Fastgraph
(unless, of course, it doesn't use any Fastgraph routines that would create a
conflict).
Extending the Time-of-Day Interrupt
As mentioned in Chapter 16, the BIOS time-of-day clock is incremented by
an interrupt handler. The routine that does this is interrupt 08, a hardware
interrupt automatically activated 18.2 times per second. After incrementing
the clock, interrupt 08 invokes interrupt 1C, which by default references a
"do-nothing" interrupt handler. While changing interrupt 08 can be tricky, it
is fairly straightforward to define our own handler for interrupt 1C. This
handler also will be executed automatically 18.2 times per second. Example C-1
illustrates how to do this.
When we discussed joysticks in Chapter 14, we said there were two ways to
monitor joystick button status. One is to intersperse calls to fg_button at
strategic places in your program and then take necessary action depending on
the button status. However, the problem with this scheme is the chance of
missing a button press -- if you press the joystick button and then release it
between calls to fg_button, the program will not detect the joystick activity.
A preferable method is to call fg_button from a handler for interrupt 1C,
which essentially provides continuous monitoring of the joystick buttons. When
we need the button status within our program, all we need to do is examine a
global variable.
Example C-1 consists of a main program (written in C) and an assembly
language subroutine named int1C (suitable for the real mode medium memory
model). The main program calls int1C to define a handler for interrupt 1C. In
response to any keystroke (except Escape), the program displays the button
press information for each joystick since the previous keystroke (refer to the
discussion of fg_button for the meanings of the status values). When you press
the Escape key, the program exits to DOS, but not before calling int1C to
restore the original interrupt 1C handler.
Example C-1 (main program).
#include <fastgraf.h>
#include <stdio.h>
void main(void);
#define ESC 27
Appendix C: Interrupts and Fastgraph 369
int status1, status2;
void main()
{
unsigned char key, aux;
int1C(1);
status1 = 0;
status2 = 0;
do {
printf("\n");
printf("Joystick 1 status: %d\n",status1);
printf("Joystick 2 status: %d\n",status2);
status1 = 0;
status2 = 0;
fg_getkey(&key,&aux);
}
while (key != ESC);
int1C(0);
}
We'll now examine the int1C assembly language subroutine. It actually
consists of three parts: a portion to enable our interrupt handler, our
handler itself, and a portion to disable the handler. When we call int1C with
a nonzero argument, it saves the original data segment (so we can access the
global variables within the handler), saves the original handler's address
(called the vector) for interrupt 1C, and then enables our handler, which
takes the form of a far procedure.
The handler routine then begins to be activated 18.2 times per second.
After saving all the important registers, the handler calls the Fastgraph
routine fg_button twice, once for each joystick. The return values are
logically ORed with the status1 and status2 C global variables to update the
button status information. Finally, the handler restores the original
registers and returns control to the point of the interrupt.
Before the main program exits, it calls int1C with a zero argument to
restore the original handler for interrupt 1C. No provision is made in the
program to check if we had previously defined our own handler (and hence saved
the original interrupt 1C vector), but this could be added with little
difficulty.
Example C-1 (assembly language subroutine).
EXTRN _status1:word ; C global variable for button 1 status
EXTRN _status2:word ; C global variable for button 2 status
EXTRN _fg_button:far ; Fastgraph routine
int1C_TEXT SEGMENT byte public 'CODE'
ASSUME cs:int1C_TEXT
370 Fastgraph User's Guide
int1C_CS dw ? ; holds original INT 1C segment address
int1C_IP dw ? ; holds original INT 1C offset
orig_DS dw ? ; holds original data segment
_int1C PROC far
PUBLIC _int1C
push bp ; save caller's BP register
mov bp,sp ; make BP point to argument list
push si ; save caller's SI register
push di ; save caller's DI register
mov dx,[bp+6] ; get the flag parameter
or dx,dx ; replace the old interrupt handler?
jz replace ; yes, branch to that processing
; define a new handler for INT 1C
define: mov ax,ds ; put current data segment in AX
mov cs:orig_DS,ax ; save it in the control information area
mov al,1Ch ; interrupt vector to save
mov ah,53 ; function 53: get interrupt vector
int 21h ; get the interrupt vector
mov cs:int1C_CS,es; save the segment
mov cs:int1C_IP,bx; save the offset
push ds ; save our DS register
mov dx,offset handler ; get offset of interrupt handler
mov ax,seg handler; get segment of interrupt handler
mov ds,ax ; put it in DS
mov al,1Ch ; interrupt vector to change
mov ah,37 ; function 37: set interrupt vector
int 21h ; change the INT 1C vector to our handler
pop ds ; restore our DS register
jmp short return ; return to the caller
; replace the original handler for INT 1C
replace: push ds ; save our DS register
mov dx,cs:int1C_IP; put original INT 1C offset in DX
mov ds,cs:int1C_CS; put original INT 1C segment in DS
mov ah,37 ; function 37: set interrupt vector
mov al,1Ch ; interrupt vector 1C
int 21h ; restore original INT 1C vector
pop ds ; restore our DS register
return: xor ax,ax ; in case int1C was called as a function
pop di ; restore our DI register
pop si ; restore our SI register
pop bp ; restore our BP register
ret
_int1C ENDP
Appendix C: Interrupts and Fastgraph 371
handler PROC far ; interrupt handler that replaces INT 1C
cli ; disable interrupts while handler active
push ax ; save registers that may be altered
push bx
push cx
push dx
push di
push si
push ds
push es
mov ds,cs:orig_DS ; retrieve the original data segment
mov ax,1 ; use joystick 1
push ax ; pass joystick number to button routine
call _fg_button ; AX = button status for joystick 1
add sp,2 ; remove the argument
or _status1,ax ; update status variable for joystick 1
mov ax,2 ; use joystick 2
push ax ; pass joystick number to button routine
call _fg_button ; AX = button status for joystick 2
add sp,2 ; remove the argument
or _status2,ax ; update status variable for joystick 2
pop es ; restore altered registers
pop ds
pop si
pop di
pop dx
pop cx
pop bx
pop ax
iret ; return from the interrupt routine
handler ENDP
int1C_TEXT ENDS
END
The example just presented is not meant to be a tutorial on interrupts;
there are many good references on DOS that explain them in detail. However, an
example specific to Fastgraph should be helpful.
372 Fastgraph User's Guide
Appendix D
Contents of the
Compiler-Specific Libraries
374 Fastgraph User's Guide
For most compilers, Fastgraph provides a compiler-specific library (also
called the auxiliary Fastgraph library) that contains the following routines:
fg_boxw fg_drawxw fg_panw fg_setsize
fg_boxxw fg_drectw fg_pointw fg_setsizew
fg_circlew fg_ellipsew fg_pointxw fg_setworld
fg_circlefw fg_ellipsfw fg_polygonw fg_swchar
fg_clprectw fg_floodw fg_rectw fg_swlength
fg_dashrw fg_getworld fg_restorew fg_swtext
fg_dashw fg_initw fg_savew fg_xscreen
fg_drawrw fg_moverw fg_setangle fg_xworld
fg_drawrxw fg_movew fg_setclipw fg_yscreen
fg_draww fg_paintw fg_setratio fg_yworld
These routines use the world space coordinate system, either directly or
internally. None of them are included in Fastgraph/Light.
As mentioned in Chapter 1, if your program uses any of these routines,
you must link it with the general Fastgraph library and the corresponding
auxiliary Fastgraph library. Some compilers, such as Microsoft Visual C++ 32-
bit Edition, Microsoft FORTRAN PowerStation, and Fastgraph's supported BASIC
compilers do not require an auxiliary library because the routines listed
above are included directly in the Fastgraph library for those compilers.
Appendix E
Contents of the
Pascal Unit Files
376 Fastgraph User's Guide
Borland Pascal and Turbo Pascal restrict the total size of all code
segments in a unit file 65,520 bytes. Because the size of Fastgraph's code
exceeds this amount, the Fastgraph functions are split among several unit
files. This appendix lists the contents of each Pascal unit file.
Fastgraph routines in FGBITMAP
fg_clipmap fg_flpimage fg_pack fg_scale
fg_clipmask fg_getblock fg_print fg_shear
fg_clpimage fg_getimage fg_printc fg_text
fg_drawmap fg_getmap fg_putblock fg_textc
fg_drawmask fg_imagebuf fg_putimage fg_unpack
fg_drwimage fg_imagesiz fg_revimage
fg_flipmask fg_invert fg_revmask
Fastgraph routines in FGFLIC
fg_flicdone fg_flicmode fg_flicplay fg_flicskip
fg_flichead fg_flicopen fg_flicsize fg_showflic
Fastgraph routines in FGGIF
fg_gifhead fg_gifpal fg_makegif fg_showgif
fg_gifmode fg_gifrange
Fastgraph routines in FGMISC
fg_button fg_kbinit fg_mousemov fg_setcaps
fg_capslock fg_kblast fg_mousepos fg_setnum
fg_cursor fg_kbreset fg_mouseptr fg_sound
fg_getclock fg_kbtest fg_mousespd fg_sounds
fg_getkey fg_measure fg_mousevis fg_suspend
fg_getxjoy fg_memavail fg_music fg_voice
fg_getyjoy fg_mouse256 fg_musicb fg_voices
fg_hush fg_mousebut fg_numlock fg_waitfor
fg_hushnext fg_mousecur fg_playing fg_waitkey
fg_initjoy fg_mousefin fg_quiet
fg_intjoy fg_mouseini fg_resume
fg_intkey fg_mouselim fg_scrlock
Fastgraph routines in FGPCX
fg_loadpcx fg_pcxhead fg_pcxpal fg_showpcx
fg_makepcx fg_pcxmode fg_pcxrange
Fastgraph routines in FGPR
fg_dispfile fg_displayp fg_makespr fg_showspr
fg_display fg_makeppr fg_showppr
Fastgraph routines in FGSVGA
fg_defpages fg_memory fg_svgainit fg_svgaver
fg_getbanks fg_setbanks fg_svgastat
Fastgraph routines in FGVB
fg_vbaddr fg_vbcut fg_vbinit fg_vbundef
fg_vballoc fg_vbdefine fg_vbopen
fg_vbclose fg_vbfree fg_vbpaste
fg_vbcopy fg_vbhandle fg_vbtcxfer
Appendix E: Contents of the Pascal Unit FIles 377
The world space routines listed in Appendix D are in the FGWORLD unit. Any
other Fastgraph routine NOT listed in this appendix is in the FGMAIN unit.
As mentioned in Chapter 1, Pascal programs must include a uses statement
listing all units referenced in the program. The fgmain unit is always
required in all programs, as is the WinAPI unit in 16-bit protected mode
programs. Other unit files are needed when you call the Fastgraph routines
they contain.
378 Fastgraph User's Guide
Appendix F
Integrating Fastgraph With
Other Graphics Software
380 Fastgraph User's Guide
Sometimes you may want to use Fastgraph with other graphics software,
such as when converting an existing graphics application to Fastgraph. This
appendix may clarify some points about doing this.
First, let the other graphics software establish the video mode, then
initialize Fastgraph for that mode by calling fg_setmode(-1). Passing -1 to
fg_setmode does not physically change video modes but merely initializes
Fastgraph's internal parameters for the current video mode.
Second, if you're using the EGA/VGA/SVGA 16-color graphics modes (modes
13 to 18, 28, and 29), you'll probably need to explicitly define the value of
the EGA/VGA Enable Set/Reset register (port address 03CE hex, index 01).
Fastgraph's functions expect this register to have the value 0F hex; this
allows Fastgraph take advantage of a more efficient variant available in
EGA/VGA write mode 0. The default value for the Enable Set/Reset register is
zero.
After you've called fg_setmode(-1) and need to call a third party
graphics function, set the Enable Set/Reset register to its default value by
including the following statement just before calling the third party
function:
outport(0x03CE,0x0001); Borland C++, Turbo C/C++, or Power C
outpw(0x03CE,0x0001); Microsoft C/C++, QuickC, WATCOM C/C++
OUT &h03CE,1 : OUT &h03CF,0 QuickBASIC, BASIC PDS, or Visual Basic
Just before you call the next Fastgraph function, restore the Enable Set/Reset
register value with the following statement:
outport(0x03CE,0x0F01); Borland C++, Turbo C/C++, or Power C
outpw(0x03CE,0x0F01); Microsoft C/C++, QuickC, WATCOM C/C++
OUT &h03CE,1 : OUT &h03CF,15 QuickBASIC, BASIC PDS, or Visual Basic
Appendix G
Converting Programs
to Protected Mode
382 Fastgraph User's Guide
In this appendix we'll describe the steps necessary for porting real mode
Fastgraph applications to protected mode. We'll also cover common changes
required when converting 16-bit applications to 32-bit protected mode.
Protected Mode Initialization
The first and most obvious step when converting programs to protected
mode is to call fg_initpm. This routine sets up protected mode features for
each supported DOS extender and must be called before any other Fastgraph
routine in protected mode programs. Failure to do this will result in a
protection fault, usually immediately after setting the video mode. The
fg_initpm routine has no arguments and no return value. It is included in the
extender-specific support libraries (for example, in FG16DPMI.LIB) if
Fastgraph supports more than one DOS extender for a given compiler.
Considerations for Logical Pages
In real mode, Fastgraph lets you create logical pages in conventional
memory (with fg_alloccms), expanded memory (with fg_allocems), or extended
memory (with fg_allocxms). In protected mode, the distinction between
conventional, expanded, and extended memory disappears because DOS extenders
essentially treat all system memory as conventional memory. For this reason,
the fg_initems and fg_initxms routines are not meaningful and thus always
return -1 in the protected mode Fastgraph libraries. This effectively disables
the fg_allocems and fg_allocxms routines, so you must create logical pages
with fg_alloccms in protected mode.
If you have real mode Fastgraph applications that use logical pages, it's
very simple to convert them to protected mode -- just change all fg_allocems
and fg_allocxms calls to fg_alloccms.
Considerations for Virtual Buffers
Chapter 8 describes the various methods available for allocating memory
for virtual buffers. Because some real mode compilers have limited support for
huge arrays (blocks of memory greater than 64K bytes), Fastgraph's fg_vballoc
and fg_vbfree routines are provided for allocating and releasing memory
suitable for virtual buffers. All protected mode compilers provide full
support for huge arrays, so these two functions aren't needed (in fact,
they're not even included in the protected mode libraries). Thus, you must
replace the fg_vballoc and fg_vbfree calls with your compiler's corresponding
memory management functions as listed in Chapter 8 and use fg_vbdefine to
create the virtual buffer.
Mouse Cursor Definition
The fg_mouseptr routine expects the screen and cursor masks to reside in
a 32-element array of 16-bit values. If you're converting a C or C++ Fastgraph
application from a 16-bit to a 32-bit environment, you must change the data
type of the screen/cursor mask array passed to fg_mouseptr from int to short.
Appendix G: Converting Programs to Protected Mode 383
FORTRAN programmers should be sure to pass an INTEGER*2 array instead of an
ordinary INTEGER array.
FORTRAN Data Types
When converting FORTRAN programs to 32-bit protected mode, any INTEGER*2
quantities passed to Fastgraph functions must be changed to four-byte
integers. For maximum portability, we recommend changing them to type INTEGER,
which is equivalent to INTEGER*2 in 16-bit environments and equivalent to
INTEGER*4 in 32-bit environments.
Incompatible Real Mode Behavior
After you've added the fg_initpm call and made the other changes
described so far, you should test your program to see if it runs in protected
mode. Most high-level language programs will work at this point with no
further changes required.
However, some programs include features that are acceptable in real mode
but not in protected mode (often this behavior is unintentional). These
practices include loading physical addresses in segment registers, using
physical segment addresses in far pointers, writing data to a code segment,
referencing unspecified command line arguments, accessing memory beyond a
segment's limit, and dereferencing null pointers. When a protected mode
program encounters one of these problems during execution, it exits to DOS
with a general protection fault, or GPF.
The documentation shipped with your DOS extender will likely provide
information on isolating protection faults and offer suggestions on how to fix
them. Two other references, Extending DOS edited by Ray Duncan (Addison-
Wesley, 1992) and DOS and Windows Protected Mode by Al Williams (Addison-
Wesley, 1993) are valuable resources for protected mode programming. Both
books include detailed information about the differences between real mode and
protected mode and discuss common protected mode programming problems and
solutions.
384 Fastgraph User's Guide
Appendix H
Image File Header Formats
386 Fastgraph User's Guide
PCX, GIF, and FLI/FLC images include file headers that define the image
size, number of colors, and other information needed to display the image.
Fastgraph provides routines for reading the image headers and retrieving their
more useful items. However, there may be times when you need additional
information stored in the file header. This appendix provides full details
about the structure of the PCX, GIF, and flic file headers. In the tables that
follow, we'll assume all offsets start at zero, all field sizes are in bytes,
and all integer values are stored with the least significant byte first.
PCX files begin with a 128-byte header:
offset size description
0 1 manufacturer byte, must be 10 decimal
1 1 PCX version number
0 = PC Paintbrush version 2.5
2 = PC Paintbrush 2.8 with palette information
3 = PC Paintbrush 2.8 without palette information
4 = PC Paintbrush for Windows
5 = PC Paintbrush 3.0 or later, PC Paintbrush Plus
2 1 run length encoding byte, must be 1
3 1 number of bits per pixel per bit plane
4 8 image limits in pixels: Xmin, Ymin, Xmax, Ymax
12 2 horizontal dots per inch when printed (unreliable)
14 2 vertical dots per inch when printed (unreliable)
16 48 16-color palette (16 RGB triples between 0-255)
64 1 reserved, must be zero
65 1 number of bit planes
66 2 video memory bytes per image row
68 2 16-color palette interpretation (unreliable)
0 = color or b&w, 1 = grayscale
70 2 horizontal screen resolution - 1 (unreliable)
72 2 vertical screen resolution - 1 (unreliable)
74 54 reserved, must be zero
GIF files begin with a 13-byte global header and a 10-byte local header:
offset size description
0 6 GIF signature, must be GIF87a or GIF89a
6 2 horizontal resolution of creating video mode (unreliable)
8 2 vertical resolution of creating video mode (unreliable)
10 1 global flag byte
bit 7 is set if global color map is present
bits 0-3 are the number of colors (2**(n+1))
11 1 background color
12 1 for GIF87a, must be zero
for GIF89a, aspect ratio
13 0 reserved, must be 44 decimal (ASCII comma)
14 2 left edge of image in pixels
16 2 top edge of image in pixels
18 2 image width in pixels
20 2 image height in pixels
22 1 local flag byte
bit 7 is set if local color map is present
Appendix H: Image File Header Formats 387
bit 6 is set if image is interlaced
bits 0-3 are the number of colors (2**(n+1))
FLI and FLC files begin with a 128-byte header:
offset size description
0 4 file size in bytes
4 2 signature, AF11 hex for FLI files, AF12 hex for FLC files
6 2 number of frames
8 2 image width in pixels
10 2 image height in pixels
12 2 bits per pixel, must be 8
14 2 reserved, must be 3
16 4 time delay between frames
units are 1/70 second for FLI files
units are milliseconds for FLC files
20 2 reserved, must be zero
22 4 file creation date/time (MS-DOS format)
26 4 creator serial number (unreliable)
30 4 file revision date/time (MS-DOS format)
34 4 updater serial number (unreliable)
38 4 horizontal aspect ratio of creating video mode
40 2 vertical aspect ratio of creating video mode
42 38 reserved, must be zero
80 4 byte offset to start of first frame
84 4 byte offset to start of second frame
88 40 reserved, must be zero
The fields starting at offset 22 and above in the flic file header apply to
FLC files only. For FLI files, they should all be zero.
388 Fastgraph User's Guide
Index 389
I n d e x
8253-5 programmable timer chip CGA palettes 70
330 Character cells 30
Active page 150 Character space 58, 126
Animation 274 Characters
dynamic frame 280 bitmapped 143
dynamic page flipping hardware 127
282 software 138
page flipping 282 Circles 107
simple 274 Clearing the screen 98
static frame 278 CLIP 357, 358
static page flipping 282 /M option 357
summary 284 /P option 357
XOR 276 /W option 357
ANSI.SYS 43 Clipping 98, 171
Assembly language 364 Clock tick 344-346
Attribute 68, 130, 131 Clock tick interrupt 335,
Autodesk Animator 192, 193 337, 344
Auxiliary Fastgraph library Color 68
374 Color indices 90
Available memory 350 Color number 70
Background color 68-70 Color value 70
BitBlt 256 Compilation 7
Bitmapped characters 143 BASIC PDS 14
Bitmapped images 212 Borland C++ 10
Bitmaps 212 Borland Pascal 12
CGA 217, 219, 226 MetaWare High C/C++ 13
converting 236 Microsoft C/C++ 15
EGA 220, 228 Microsoft FORTRAN 16
filler bits 213 Microsoft FORTRAN
Hercules 220 PowerStation 17
inverting 234 Power C 23
MCGA 222 QuickBASIC 18
memory requirements 232 QuickC 19
mode-independent 212 Turbo C 24
mode-specific 217 Turbo C++ 24
PCjr 220 Turbo Pascal 25
retrieving 229 Visual Basic 20
rotation 242 Visual C++ 21, 22
scaling 239 WATCOM C/C++ 26
shearing 239, 240 Zortech C++ 27
subscript order 213, Compiler-specific Fastgraph
214, 224 library 374
SVGA 220, 222 CONVERT 358, 359
Tandy 220 /PPR switch 358
text modes 223 /SPR switch 358
VGA 220, 222 Convex shape 106
virtual buffers 223 Coordinate conversion 64,
Blit 256 135, 137
Block transfer routines 256 Current color 70
Borland C++ 3, 10 Cursor mask 316, 318
Borland Pascal 3, 12 Dash pattern 103
Byte boundary 257, 258 Delay units 345, 346
CapsLock 304-306 Display patterns 200
390 Fastgraph User's Guide
CGA 201, 202 fg_button 324, 325, 327,
EGA 203 368, 369
Hercules 203 fg_capslock 305, 306,
MCGA 204 327
PCjr 202 fg_chgattr 130, 144
SVGA 203 fg_chgtext 130, 144
Tandy 202 fg_circle 107, 108, 121
VGA 203, 204 fg_circlef 107, 121
Dithering 112 fg_circlefw 107, 121
Dithering matrix 113 fg_circlew 107, 108, 121
256-color modes 118 fg_clipmap 215, 236, 251
alignment 119 fg_clipmask 248, 249,
CGA 113, 114 251
EGA 116 fg_clpimage 225-227,
Hercules 116 229, 248, 249, 251
PCjr 115 fg_clprect 109, 121,
SVGA 116 274, 282, 283
Tandy 115 fg_clprectw 109, 121
VGA 116 fg_colors 70, 94, 99
DOS extenders 4, 5 fg_copypage 162-164,
supported 4 168, 170, 181, 256,
EDITSPR 359 271
Ellipses 108 fg_cursor 42, 56, 94,
EMM386.EXE 161 132, 261
EMS 161 fg_dash 103, 121
Expanded memory 161 fg_dashrel 103, 121
Expanded Memory Manager 161 fg_dashrw 103, 121
Extended memory 161 fg_dashw 103, 122
Fade 85, 86 fg_defcolor 91, 92, 94,
FASTGRAF.BI 8 119
FASTGRAF.FI 9 fg_defpages 164-166, 181
FASTGRAF.H 8 fg_dispfile 199, 200,
Fastgraph 2 209, 246
fastgraph routines fg_display 244-247, 251
fg_allocate 152, 153, fg_displayp 245-247, 252
155, 156, 159, 160, fg_draw 101, 122, 292
169, 170, 180, 256, fg_drawmap 144, 212,
261, 350 214, 215, 217, 229,
fg_alloccms 161, 162, 230, 231, 232, 236,
168, 169, 382 244, 248, 250, 252,
fg_allocems 161, 162, 264, 284, 318, 321
180, 382 fg_drawmask 248-250, 252
fg_allocxms 161, 162, fg_drawrel 101, 119, 122
181, 382 fg_drawrelx 101, 122
fg_automode 47, 48, 55, fg_drawrw 101, 122
99, 108, 109, 294 fg_drawrxw 101, 122
fg_bestmode 44, 48, 49, fg_draww 101, 122
51, 55, 119, 153, fg_drawx 101, 122
155, 156, 270 fg_drawxw 101, 122
fg_box 110, 121 fg_drect 113, 116-119,
fg_boxdepth 110, 111, 122
121 fg_drectw 113, 118, 119,
fg_boxw 110, 121 122
fg_boxx 111, 112, 121 fg_drwimage 144, 217,
fg_boxxw 111, 112, 121 218, 219, 221-227,
229, 232, 234-237,
Index 391
240, 244, fg_getmaxx 59, 60, 64,
248-250, 252, 99, 109
284, 321 fg_getmaxy 59, 60, 65,
fg_ellipse 108, 122, 278 99, 109, 298
fg_ellipsef 108, 122 fg_getmode 44, 56, 364
fg_ellipsew 108, 122 fg_getpage 158, 159, 181
fg_ellipsfw 108, 123 fg_getpixel 99, 123
fg_erase 98, 123, 166, fg_getrgb 84-86, 95
170 fg_getview 61, 65
fg_fadein 288, 289, 300 fg_getvpage 158, 159,
fg_fadeout 288, 300 181
fg_fillpage 98, 123 fg_getworld 63, 65
fg_findpage 158, 162, fg_getxbox 110, 123
168, 181 fg_getxjoy 324-327
fg_flicdone 195, 209 fg_getxjust 133, 144
fg_flichead 193, 194, fg_getxpos 101, 123
209 fg_getybox 110, 123
fg_flicmode 194, 209 fg_getyjoy 324-327
fg_flicopen 194, 195, fg_getyjust 133, 144
209 fg_getypos 101, 123
fg_flicplay 195, 209 fg_gifhead 191, 209
fg_flicsize 194, 209 fg_gifmode 191, 209
fg_flicskip 195, 209 fg_gifpal 191
fg_flipmask 248, 249, fg_gifrange 191, 209
252 fg_hush 335, 338, 340
fg_flood 119, 123 fg_hushnext 335, 338,
fg_floodw 119, 123 340
fg_flpimage 226, 227, fg_imagebuf 184, 193,
229, 248, 249, 252 206, 207-209
fg_fontsize 135, 136, fg_imagesiz 232, 233,
144 252, 270
fg_freepage 153, 155, fg_initems 161, 162,
156, 161, 167, 181, 167, 181, 382
350 fg_initjoy 167, 323,
fg_getaddr 158, 159, 181 324, 327
fg_getattr 131, 144 fg_initpm 3, 7, 382, 383
fg_getbanks 353, 354 fg_initw 62, 63, 65,
fg_getblock 270, 272 100, 138, 139
fg_getchar 131, 144 fg_initxms 161, 162,
fg_getclip 98, 123 167, 181, 382
fg_getclock 345, 347 fg_inside 107, 123
fg_getcolor 69, 70, 77, fg_intjoy 325-327
94 fg_intkey 304, 305, 307,
fg_getdacs 86-88, 94, 325, 327, 338, 345
353 fg_invert 234, 235, 252
fg_getentry 168, 179, fg_justify 132, 133, 145
181 fg_kbinit 307-309, 327
fg_gethpage 259, 272 fg_kblast 309, 327
fg_getimage 131, 229, fg_kbreset 309, 327
232, 233, 239, 241, fg_kbtest 307, 308, 327
252, 270, 284 fg_loadpcx 184, 186,
fg_getindex 95 187, 209, 242
fg_getkey 304, 307, 327 fg_locate 127-129, 132,
fg_getlines 45, 56 135, 145, 150, 157,
fg_getmap 229-233, 252, 233
264, 284 fg_makegif 190, 191, 210
392 Fastgraph User's Guide
fg_makepcx 184-186, 190, fg_pcxmode 188, 210
191, 197, 210 fg_pcxpal 188, 209, 210
fg_makeppr 199, 210 fg_pcxrange 188, 210
fg_makespr 197, 199, 210 fg_playing 336, 338, 340
fg_maprgb 89, 95, 188 fg_point 99, 100, 124
fg_measure 298, 346, 347 fg_pointw 99, 100, 124
fg_memavail 350, 354 fg_pointx 100, 124
fg_memory 53, 56, 164 fg_pointxw 100, 124
fg_mouse256 322 fg_polyedge 107, 124
fg_mousebut 313, 314, fg_polyfill 105-107, 124
327 fg_polygon 104, 105, 124
fg_mousecur 315, 317, fg_polygonw 104, 124
327 fg_polyline 105, 107,
fg_mousefin 311, 327 124
fg_mouseini 167, 309, fg_polyoff 105, 107
310, 311, 314, 327 fg_print 132, 133, 135,
fg_mouselim 311, 312, 144, 145
328 fg_printc 133, 135, 145
fg_mousemov 311, 312, fg_putblock 270, 272
328 fg_putimage 223, 226,
fg_mousepos 311, 313, 229, 239, 241, 248,
314, 328 252, 270
fg_mouseptr 315, 320, fg_quiet 331-333, 340
322, 328, 382 fg_rect 61, 80, 84, 109,
fg_mousespd 312, 328 110, 113, 124, 135,
fg_mousevis 311, 312, 137, 150, 214, 218,
314, 328 261, 274, 282
fg_move 100, 101, 103, fg_rectw 109, 124, 143
119, 123, 133, 197, fg_reset 43, 44, 56, 364
199, 215, 216, 230, fg_resize 166, 167, 181,
231, 233, 247, 264, 295, 300
292 fg_restore 164, 259,
fg_moverel 100, 101, 123 261, 262, 263, 266,
fg_moverw 100, 123 270, 272, 282, 289
fg_movew 100, 123 fg_restorew 259, 272
fg_music 333-335, 338, fg_resume 339, 340
340 fg_revimage 225-227,
fg_musicb 338-340 229, 235, 248, 249,
fg_numlock 305, 306, 328 252
fg_pack 236, 237, 239, fg_revmask 248, 249, 252
252 fg_save 164, 259, 261,
fg_pagesize 160, 170, 262, 263, 266, 270,
181 272
fg_paint 119, 123, 292 fg_savew 259, 272
fg_paintw 119, 123 fg_scale 239, 240, 242,
fg_palette 71-80, 82-84, 252
89, 90, 94, 95, 188, fg_scrlock 305, 306, 328
223 fg_scroll 290-292, 300
fg_palettes 90, 95, 188, fg_setangle 141, 142,
353 145
fg_pan 293-296, 298, fg_setattr 68, 69, 95,
300, 353 98, 127, 128, 130,
fg_panw 293, 294, 300 145, 150, 151, 154,
fg_pattern 200, 201, 156
205, 210, 245, 246 fg_setbanks 353, 354
fg_pcxhead 188, 210 fg_setcaps 306, 328
Index 393
fg_setclip 62, 98, 124, fg_split 298, 300
133, 225 fg_stall 298, 345-347
fg_setclipw 98, 124, 133 fg_suspend 339-341
fg_setcolor 42, 69-80, fg_svgainit 51-54, 56,
82-84, 95, 98, 99, 164, 353
116, 117, 127, 130, fg_svgastat 54, 56, 164,
138, 145, 150, 151, 259
154, 156, 214, fg_svgaver 53, 56
275-277, 290, 291 fg_swchar 138-140, 142,
fg_setdacs 86-88, 95, 145
188, 353, 360 fg_swlength 142, 143,
fg_setentry 168, 170, 145
179, 181 fg_swtext 142, 143, 145
fg_setfunc 276, 351, 354 fg_tcdefine 267-269, 272
fg_sethpage 259, 261, fg_tcmask 267-269, 272
272, 288, 290 fg_tcxfer 164, 267, 269,
fg_setlines 45, 56 272
fg_setmode 42, 44, 51, fg_testmode 43, 44, 49,
56, 70, 77, 83, 88, 51, 54, 56, 87, 150,
91, 98-100, 108, 153, 228, 259, 332
109, 115, 116, 127, fg_text 42, 127-130,
128, 130, 133, 139, 132, 133, 135, 136,
150, 157, 161, 165, 138, 144, 145
166, 167, 168, 175, fg_textc 133, 135, 145
201, 202-204, 228, fg_transfer 164, 262,
302, 310, 323, 364, 263, 264-267, 270,
380 272, 280, 282, 283,
fg_setnum 306, 328 289
fg_setpage 150, 165, fg_unpack 237, 239, 252
182, 259 fg_vbaddr 243, 253
fg_setratio 139, 141, fg_vballoc 172, 175,
145 182, 243, 382
fg_setrgb 73, 76, 80, fg_vbclose 173, 175, 182
82, 83, 84, 86, 89, fg_vbcopy 262, 266, 272
94, 95, 205, 223 fg_vbcut 173, 175, 179,
fg_setsize 139, 145 182, 262, 266
fg_setsizew 139, 145 fg_vbdefine 171-173,
fg_setview 60, 61, 65 182, 243, 382
fg_setvpage 150, 160, fg_vbfree 172, 175, 182,
161, 182, 282, 283, 382
298, 311, 353 fg_vbhandle 171, 182
fg_setworld 63, 65, 138, fg_vbinit 171, 182
139 fg_vbopen 173, 182
fg_shear 240-242, 252 fg_vbpaste 173, 175-177,
fg_showflic 192, 193, 179, 182, 186, 188,
195, 210 238, 262, 266, 269,
fg_showgif 190, 191, 210 297, 298
fg_showpcx 184-188, 190, fg_vbtcxfer 267, 269,
193, 206, 208, 210 272
fg_showppr 199, 210 fg_vbundef 171, 182
fg_showspr 197, 199, fg_version 7, 53, 364
200, 210 fg_vgastate 353, 354
fg_sound 330-333, 335, fg_voice 331-333, 335,
336, 341 336, 337, 341
fg_sounds 335, 336, 338, fg_voices 336-338, 341
341
394 Fastgraph User's Guide
fg_waitfor 85, 274, 280, GrabRGB 200, 359, 360
282, 292, 294, 305, /D option 360
312, 333, 344-347 output file format 360
fg_waitkey 43, 304, 307, Graphics cursor 100
328 Graphics modes 30, 33, 70
fg_waitvr 352-354 256-color 83
fg_where 129, 146, 157 CGA 33, 70, 72
fg_xalpha 64, 65, 137, EGA 35, 76, 78, 79
146 Hercules 34, 74, 75
fg_xconvert 64, 65, 137, MCGA 36, 81
146 native EGA 35
fg_xscreen 64, 65, 99 native VGA 36
fg_xview 61, 65 PCjr 34, 73
fg_xworld 64, 65, 101 SVGA 38, 83
fg_yalpha 64, 65, 137, Tandy 73
146 Tandy 1000 34
fg_yconvert 64, 65, 137, VGA 36, 81, 83
146 XVGA 37
fg_yscreen 64, 65, 99 Hardware characters 127
fg_yview 61, 65 graphics modes 132
fg_yworld 64, 65, 101 height 135
Fastgraph/Light 2 side effects 134
Fastgraph/Light Video Driver text modes 127
2, 28 HERCFIX 360, 361
FG32 symbol 8 Hidden page 150, 259
FGDRIVER 28 HIMEM.SYS 161
/U option 28 Hot spot 320
Filler bits 213 Image array 224
Fish tank animation demo 284 Image buffer 206
FLC files (see flic files) Images 184
192 clipped 225
FLI files (see flic files) regular 217
192 reversed 225
Flic files 192 reversed clipped 226
context descriptor 194, without transparent
195 pixels 226
continuous play 192, 193 INCLUDE environment variable
delta compression 192 8
dimensions 194 Input devices 302
header 194, 387 INSTALL program 6
high-level routines 192 /L option 6
low-level routines 194, Installation 6
195 Interrupts 353, 368
playing 192 Joystick 323
Flickering 352 button status 324, 325,
Foreground color 68, 69 368
Full page transfer 256 calibration 324
Game port 323 characteristics 324
General protection fault 383 horizontal position 324
GIF files 189 initialize 323
creating 190 keyboard emulation 325
dimensions 191 special considerations
displaying 190 326
header 191, 386 vertical position 324
palette 191 Keyboard 302
GPF 383 buffer 304, 345
Index 395
extended codes 302 freezing 311
handler 307 graphics modes 318
standard codes 302 hot spot 320
state light 306 multicolored 322
Lines text modes 316
dashed 103 Mouse driver 309
solid 101 Music 333
Linking 7 asynchronous 338
Logical pages 161, 382 restarting 339
creating 161 stopping 338
releasing 161 suspending 339
Masking map 223, 248-250 synchronous 333
Memory conflicts Music commands 333
logical pages 169 Music string 333, 338
virtual buffers 172 Musical notes 333
virtual pages 169 Naming conventions 7
Memory models 5 NumLock 304-306
flat 5 Overscan 71
large 5 Packed pixel run file 196,
medium 5 198
small 5 Packed pixel run map 199, 245
Memory update function 351 Page flipping 282, 284, 352,
MetaWare High C/C++ 13 353
Mickeys 312 Palette 31
Microsoft BASIC PDS 3, 14 Palette number 73, 76, 78,
Microsoft C/C++ 3, 15 79, 82
Microsoft FORTRAN 3, 16 Palette registers 73, 76, 78,
Microsoft FORTRAN PowerStation 79, 81, 83, 90, 91
17 Palette value 73, 76, 78, 79
Microsoft Mouse 309 Palettes 73, 76, 78, 79, 81,
Microsoft QuickBASIC 3, 18 83
Microsoft QuickC 3, 19 Panning 166, 295, 352
Microsoft Visual Basic for DOS PC Paintbrush 184
3, 20 PCX files 184
Microsoft Visual C++ 3, 21, creating 184
22 dimensions 188
Mode X 38 displaying 184
Mouse 309 header 188, 386
button status 313 palette 188
CGA Considerations 321 video mode compatibility
cursor 311, 315 187
cursor mask 316, 318, virtual buffers 186
382 PCXHEAD 361
cursor visibility 311 PDS BASIC 14
default cursor 318 Periodic noise 332
hot spot 320 Physical pages 148
initialize 309 Pixel bleeding 322
limits 312 Pixel run 196
position 311, 313 Pixel run file 196, 197, 199,
screen mask 316, 318, 200, 246
382 Pixel run map 196, 200, 244,
screen updates 311 245
speed 312 Pixels 30
SVGA 310, 322 Points 99
XVGA 310, 322 Polygon
Mouse cursor 311, 315, 382 filled 105, 106
396 Fastgraph User's Guide
unfilled 104, 105 superscript operator (\^)
vertex offsets 105 140
Power C 3, 23 underline operator (_)
PPR file 196, 198 140
Project file 10, 24 Sound 330
Protected mode 4 asynchronous 335
Protection fault 383 disk accesses during 335
Put_string 129 duration 330
QuickBASIC 3, 18 frequency 330
QuickC 3, 19 PCjr 330
READ.ME file 6 stopping 338
Real mode 4 synchronous 330
Real-time operations 344 Tandy 330
Rectangles volume 330
dithered 112 Sound effects 330-332
solid 109 Split screen 298
unfilled 110 activating 298
Region fill 119 canceling 300
Register preservation 364 Splitter cable 323
Resolution 30 SPR file 196
Reverse video 130 Standard color set 70
RGB color mapping 89 Standard pixel run file 196
Rotation 242 Stroke characters 138
Rubberband boxes 101, 111 SuperVGA 50
Scaling 239 SVGA 50
Scan codes 307, 308 chipset 50
Screen dissolving 288 dual banks 259
Screen mask 316, 318 external bank switching
Screen origin 293 353
Screen space 58, 59 initialization 51-53
Scrolling 290 kernel 38, 50-55, 353
circular 290 kernel version 52, 53
end-off 290 monitor compatibility 55
increment 290 problematic cards 55
region 290 supported chipsets 50,
ScrollLock 304-306 51
Shadow 130 VESA compatibility 51
Shearing 240 video memory present 53
Sliding tone 331 Texas Instruments SN76496A
SNAPSHOT 200, 356, 357, 359, sound chip 330
360 Text cursor 42, 127, 157
error tone 356 Text modes 30, 31, 68
image files 356 43 lines 45
success tone 356 50 lines 45
Software characters 138 color 68
alternate font 138, 139, monochrome 69
142 TI sound chip 330
angle 141 Transparency 212, 218-220,
aspect ratio 139 222, 223, 226, 227,
font change operator (\) 244, 248, 250,
139 267-269
primary font 138, 139 Turbo C 3, 24
size 139 Turbo C++ 3, 24
string length 142 Turbo Pascal 3, 25
subscript operator (\v) Vector characters 138
140 Vertical retrace 352
Index 397
VESA 51 240, 242, 266,
Video DAC registers 81-84, 269, 290, 293,
86, 90, 352 351
EGA modes 87 scaling 239, 242
Video modes 30 shearing 240, 242
mode 00 32 Virtual colors 90, 91
mode 01 32 Virtual pages 148
mode 02 32 creating 152
mode 03 32 heap requirements 159
mode 04 33 page flipping 160
mode 05 34 releasing 153
mode 06 34 writing to unallocated
mode 07 33 160
mode 09 34 Visual Basic 3, 20
mode 11 35 Visual C++ 3, 21, 22
mode 12 35 Visual effects 289
mode 13 35 Visual page 150
mode 14 35 Warbling 331
mode 15 36 WATCOM C/C++ 26
mode 16 36 WHATS.NEW file 7
mode 17 36 White noise 332
mode 18 37 World space 58, 62
mode 19 37 XMS 161
mode 20 37 XOR boxes 111
mode 21 37 XOR lines 101
mode 22 38 XOR pixels 100
mode 23 38 Zortech C++ 3, 27
mode 24 38
mode 25 38
mode 26 39
mode 27 39
mode 28 39
mode 29 39
mode X 38
summary 30
Video page resizing 295
Video pages 31, 148
active 150
extended 148, 163, 167
hidden 150, 259
logical 148, 161
physical 148
preserving 158, 167
resizing 166
segment address 158
virtual 148, 152
visual 150
Video state
restoring 353
saving 353
Video subsystem 31
Viewports 58, 60
Virtual buffer memory 171
Virtual buffers 148, 171-173,
175-177, 180, 186,
190, 192, 223, 239,